import {
  post,
  get,
  put,
  dalete,
  postJosn,
  putone,
  patch,
} from '../utils/request';

// 总部发券-查询会员
export function queryMemberInformation(data) {
  return post('/api/member-service/v1/member/queryMemberInformation', data);
}
// 总部发券-查询发券记录
export function querySendRecord(data) {
  return post('/api/promotion-service/v1/SendRecord/qrySendRecord', data);
}
// 总部发券-查询发券详情
export function querySendRecordDetail(data) {
  return post('/api/promotion-service/v1/coupon/sendCouponRecord', data);
}
// 总部发券-保存
export function createSendRecord(data) {
  return post('/api/promotion-service/v1/SendRecord/createSendRecord', data);
}
// 总部发券-查询已发券的会员
export function querySendCouponMember(data) {
  return post(
    '/api/promotion-service/v1/promotionCoupon/queryMemberCouponMemberInfo',
    data
  );
}

// 查询店铺等级-不分页
export function queryStoreGradelevelRule(data) {
  return post(
    '/api/user-service/v1/StoreGradelevelLule/queryStoreGradelevelRule',
    data
  );
}
// 查询店铺等级-分页
export function queryStoreGradelevelLule(data) {
  return post(
    '/api/user-service/v1/StoreGradelevelLule/queryStoreGradelevelLule',
    data
  );
}

// 查询卡券列表
export function queryCouponList(data) {
  return post('/api/promotion-service/v1/coupon/queryCouponPageList', data);
}
// 按ID查询卡券
export function queryCouponById(data) {
  return get('/api/promotion-service/v1/coupon/queryCouponById?uuid=' + data);
  // return get('http://10.51.4.167:9090/v1/coupon/queryCouponById?uuid=' + data);
}
// 新增卡券
export function createCoupon(data) {
  return post('/api/promotion-service/v1/coupon/createCoupon', data);
}
// 修改卡券
export function updateCoupon(data) {
  return post('/api/promotion-service/v1/coupon/updateCoupon', data);
  // return post('http://10.51.4.167:9090/v1/coupon/updateCoupon', data);
}
// 修改卡券状态
export function updateCouponStatus(data) {
  return post('/api/promotion-service/v1/coupon/updateCouponByStatus', data);
}
// 查询定向卷发行列表
export function queryCouponStatistics(data) {
  return post('/api/promotion-service/v1/coupon/queryCouponStatistics', data);
}
// 查询定向卷发行门店列表
export function queryCouponStatisticsOrg(data) {
  return post(
    '/api/promotion-service/v1/coupon/queryCouponStatisticsOrg',
    data
  );
}

// 查询方案列表
export function queryPromotionList(data) {
  return post(
    '/api/promotion-service/v1/promotionBuyFree/qryPlanActiviteList',
    data
  );
}
// 按id查询方案
export function queryPromotionById(planId, data) {
  return get(
    '/api/promotion-service/v1/TPlan/getPlanInfo?planId=' + planId,
    data
  );
}
// 新增方案
export function createTPlan(data) {
  return post('/api/promotion-service/v1/TPlan/createTPlan', data);
}
// 修改方案状态
export function updatePlanStatus(planId, status, data) {
  return post(
    '/api/promotion-service/v1/TPlan/editPlanInfo?planId=' +
      planId +
      '&status=' +
      status,
    data
  );
}
// 大区移除
export function deleteZq(data) {
  return post('/api/promotion-service/v1/coupon/deleteZq', data);
}

// 查询卡券领用记录
export function queryMemberCouponList(data) {
  return post(
    '/api/promotion-service/v1/winningRecord/queryMemberCouponList',
    data
  );
}

// 保存方案
export function savePromotion(data) {
  return post('/api/promotion-service/v1/coupon/creatCoupon', data);
}
// 修改卡券状态
export function updatePromotionStatus(data) {
  return post('/api/promotion-service/v1/coupon/deleteCoupon', data);
}

// 查询所有大区
export function getWarzoneList(data) {
  return post('/api/user-service/v1/detail/getWarzoneList ', data);
}
//查询门店信息
export function queryStoreByPlanId(data) {
  return post('/api/promotion-service/v1/coupon/queryStoreByPlanId', data);
}
export function queryStoreInfo(data) {
  return post('/api/user-service/v1/organization/queryStoreInfo', data);
}
//查询门店信息
export function getproductinfo(data) {
  return post('/api/goods-service/v1/goods/queryGoodsByPage', data);
}
//查询会员等级规则
// export function getmemberrules(data) {
//   return post('/api/member-service/v1/memberRule/queryMemberRules', data);
// }
//促销活动创建
export function creatactive(data) {
  return post(
    '/api/promotion-service/v1/promotionPlan/createPromotionPlan',
    data
  );
}
//促销活动修改
export function modifyPromotionPlan(data) {
  return post(
    '/api/promotion-service/v1/promotionPlan/modifyPromotionPlan',
    data
  );
}
//促销活动删除
export function delactive(data) {
  return postJosn(
    '/api/promotion-service/v1/promotionPlan/removePromotionPlan',
    data
  );
}
//查询赠品
export function searchgetgift(data) {
  return post('/api/goods-service/v1/goodsPrice/queryStockGoods', data);
}
//查询赠品明细
export function queryPromotionPlanById(data) {
  return get(
    '/api/promotion-service/v1/promotionPlan/queryPromotionPlanById',
    data
  );
}

//分页查询商品活动列表
export function queryGoodsActivityList(data) {
  return post(
    '/api/promotion-service/v1/promotionBuyFree/qryPlanActiviteList',
    data
  );
  //return post('http://127.0.0.1:18080/api/promotion-service/v1/promotionBuyFree/qryBuyFreeActiviteList', data);
}

//发布撤回删除活动
export function updateGoodsActivityStatus(data) {
  return post(
    '/api/promotion-service/v1/promotionBuyFree/editPlanActiviteInfo?uuid=' +
      data.uuid +
      '&status=' +
      data.status
  );
  //return post('http://127.0.0.1:18080/api/promotion-service/v1/promotionBuyFree/editBuyFreeActiviteInfo?uuid='+data.uuid+'&status='+data.status);
}

//删除活动
export function deleteGoodsActivity(data) {}

//挑选赠品
export function queryChooseGiftsList(data) {
  return post('/api/promotion-service/v1/promotionBuyFree/qryGiftBank', data);
  //return post('http://127.0.0.1:18080/api/promotion-service/v1/promotionBuyFree/qryGiftBank', data);
}

//保存活动（全部数据）
export function saveGiftActivityWithGoods(data) {
  return post(
    '/api/promotion-service/v1/promotionBuyFree/editPlanActiviteList',
    data
  );
  //return post('http://127.0.0.1:18080/api/promotion-service/v1/promotionBuyFree/editBuyFreeActivite', data);
}

//保存活动（全部数据）
export function qryShareActiviteInfo(data) {
  return get(
    '/api/promotion-service/v1/promotionBuyFree/qryPlanActiviteInfo',
    data
  );
  //return post('http://127.0.0.1:18080/api/promotion-service/v1/promotionBuyFree/editBuyFreeActivite', data);
}


// 优惠券分发接口
export function couponAttach(data) {
  return post('/api/promotion-service/v1/coupon/couponAttach', data);
}

// 商家端优惠券列表
export function queryCouponStorePageList(data) {
  return post('/api/promotion-service/v1/coupon/queryCouponStorePageList', data);
}

// 更新优惠券状态
export function couponJoinByStore(data) {
  return post('/api/promotion-service/v1/coupon/CouponJoinByStore', data);
}

// 查询优惠券详情(新)
export function queryStoresByIdAndOrgSeq(params) {
  return get('/api/promotion-service/v1/coupon/queryStoresByIdAndOrgSeq', params);
}

// 撤回优惠券
export function couponDetachStore(data) {
  return post('/api/promotion-service/v1/coupon/couponDetachStore', data);
}